package com.frain.springcloud.listener.sublistener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import com.frain.springcloud.listener.entity.MyEvent;

@Component
public class TestListener implements ApplicationListener<ApplicationEvent> {

    @Override
    public void onApplicationEvent(ApplicationEvent event) {

        if (event instanceof MyEvent) {
            MyEvent myevent = (MyEvent) event;
            System.out.println(myevent.getSource());
            System.out.println(myevent.getUserName());
            System.out.println(myevent.getPassword());
        }

    }

}
